package com.springboot.chapter3.config;

import com.springboot.chapter3.pojo.DataBaseProperties;
import com.springboot.chapter3.pojo.ScopeBean;
import com.springboot.other.pojo.Squirrel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 作者：paopao
 * 版本：1.0
 */
public class IoCTest {
    private static Logger log = LogManager.getLogger(IoCTest.class);
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext(AppConfig.class);
//        User user = (User) context.getBean("user");
//        log.info(user);

//        User user = context.getBean(User.class);
//        log.info(user);

//        Person person = context.getBean(BusinessPerson.class);
//        person.service();

//        DataBaseProperties db = context.getBean(DataBaseProperties.class);
//        log.info(db);

//        ScopeBean scopeBean1 = context.getBean(ScopeBean.class);
//        ScopeBean scopeBean2 = context.getBean(ScopeBean.class);
//        System.out.println((scopeBean1 == scopeBean2));

        Squirrel squirrel = context.getBean(Squirrel.class);
        log.info(squirrel);
        context.close();
    }
}
